using System;
using System.Collections.Generic;
using System.IO;

namespace org.jawk.intermediate
{
	[System.Serializable]
	public class AwkTuples
	{
		[System.Serializable]
		private class AddressImpl : org.jawk.intermediate.IAddress
		{
			private string lbl;

			private int idx = -1;

			public AddressImpl(string lbl)
			{
				this.lbl = lbl;
			}

			public virtual string Label()
			{
				return lbl;
			}

			public override string ToString()
			{
				return Label();
			}

			public virtual void AssignIndex(int idx)
			{
				this.idx = idx;
			}

			public virtual int Index()
			{
				//assert idx >= 0 : toString();
				return idx;
			}
		}

		private class PositionImpl : org.jawk.intermediate.IPositionForInterpretation, org.jawk.intermediate.IPositionForCompilation
		{
			private int idx = 0;

            private org.jawk.intermediate.AwkTuples.Tuple tuple = null;

            

			// index within the queue
			// current tuple
			public virtual int Index()
			{
				return this.idx;
			}

			public virtual bool IsEOF()
			{
				return this.idx >= this._enclosing.queue.Count;
			}

			public virtual void Next()
			{
				//assert tuple != null;
				++this.idx;
				this.tuple = this.tuple.next;
			}

			//assert queue.size() == idx || queue.get(idx) == tuple;
			public virtual void Jump(org.jawk.intermediate.IAddress address)
			{
				this.tuple = this._enclosing.queue[this.idx = address.Index()];
			}

			public override string ToString()
			{
				return "[" + this.idx + "]-->" + this.tuple.ToString();
			}

			public virtual int Opcode()
			{
				return this.tuple.opcode;
			}

			public virtual int IntArg(int arg_idx)
			{
				System.Type c = this.tuple.types[arg_idx];
				if (c == typeof(int))
				{
					return this.tuple.ints[arg_idx];
				}
				throw new System.Exception("Invalid arg type: " + c + ", arg_idx = " + arg_idx + 
					", tuple = " + this.tuple);
			}

			public virtual bool BoolArg(int arg_idx)
			{
				System.Type c = this.tuple.types[arg_idx];
				if (c == typeof(bool))
				{
					return this.tuple.bools[arg_idx];
				}
				throw new System.Exception("Invalid arg type: " + c + ", arg_idx = " + arg_idx + 
					", tuple = " + this.tuple);
			}

			public virtual object Arg(int arg_idx)
			{
				System.Type c = this.tuple.types[arg_idx];
				if (c == typeof(int))
				{
					return this.tuple.ints[arg_idx];
				}
				if (c == typeof(double))
				{
					return this.tuple.doubles[arg_idx];
				}
				if (c == typeof(string))
				{
					return this.tuple.strings[arg_idx];
				}
				if (c == typeof(org.jawk.intermediate.IAddress))
				{
					//assert arg_idx == 0; 
					return this.tuple.address;
				}
				throw new System.Exception("Invalid arg type: " + c + ", arg_idx = " + arg_idx + 
					", tuple = " + this.tuple);
			}

			public virtual org.jawk.intermediate.IAddress AddressArg()
			{
				//assert tuple.address != null || tuple.has_func_addr != null : "tuple.address = "+tuple.address+", tuple.has_func_addr = "+tuple.has_func_addr;
				if (this.tuple.address != null)
				{
					return this.tuple.address;
				}
				else
				{
					return this.tuple.address = this.tuple.has_func_addr.GetFunctionAddress();
				}
			}

			public virtual System.Type ClassArg()
			{
				//Tuple tuple = queue.get(idx);
				//assert tuple.cls != null;
				return this.tuple.cls;
			}

			public virtual int LineNumber()
			{
				//assert tuple.lineno != -1 : "The line number should have been set by queue.add(), but was not.";
				return this.tuple.lineno;
			}

			public virtual int Current()
			{
				return this.idx;
			}

			public virtual void Jump(int idx)
			{
				this.tuple = this._enclosing.queue[this.idx = idx];
			}

			internal PositionImpl(AwkTuples _enclosing)
			{
				this._enclosing = _enclosing;

                tuple = this._enclosing.queue.Count == 0 ? null : this._enclosing.queue[this.idx];
			}

			private readonly AwkTuples _enclosing;
		}

		[System.Serializable]
		private class Tuple
		{
            public int opcode;

            public int[] ints = new int[4];

            public bool[] bools = new bool[4];

            public double[] doubles = new double[4];

            public string[] strings = new string[4];

            public System.Type[] types = new System.Type[4];

			public org.jawk.intermediate.IAddress address = null;

			public System.Type cls = null;

			[System.NonSerialized]
            public org.jawk.intermediate.IHasFunctionAddress has_func_addr = null;

			public int lineno = -1;

            public org.jawk.intermediate.AwkTuples.Tuple next = null;

            public Tuple(int opcode)
			{
				// made public to access static members of AwkTuples via Java Reflection
				// to avoid polluting the constructors,
				// setLineNumber(int) populates this field
				// (called by an anonymous inner subclass of ArrayList,
				// assigned to queue - see above)
				this.opcode = opcode;
			}

            public Tuple(int opcode, int i1)
                : this(opcode)
			{
				ints[0] = i1;
				types[0] = typeof(int);
			}

            public Tuple(int opcode, int i1, int i2)
                : this(opcode, i1)
			{
				ints[1] = i2;
				types[1] = typeof(int);
			}

            public Tuple(int opcode, int i1, bool b2)
                : this(opcode, i1)
			{
				bools[1] = b2;
				types[1] = typeof(bool);
			}

            public Tuple(int opcode, int i1, bool b2, bool b3)
                : this(opcode, i1, b2)
			{
				bools[2] = b3;
				types[2] = typeof(bool);
			}

            public Tuple(int opcode, double d1)
                : this(opcode)
			{
				doubles[0] = d1;
				types[0] = typeof(double);
			}

            public Tuple(int opcode, string s1)
                : this(opcode)
			{
				strings[0] = s1;
				types[0] = typeof(string);
			}

            public Tuple(int opcode, bool b1)
                : this(opcode)
			{
				bools[0] = b1;
				types[0] = typeof(bool);
			}

            public Tuple(int opcode, string s1, int i2)
                : this(opcode, s1)
			{
				ints[1] = i2;
				types[1] = typeof(int);
			}

            public Tuple(int opcode, org.jawk.intermediate.IAddress address)
                : this(opcode)
			{
				this.address = address;
				types[0] = typeof(org.jawk.intermediate.IAddress);
			}

            public Tuple(int opcode, string strarg, int intarg, bool boolarg)
                : this(opcode, 
				strarg, intarg)
			{
				bools[2] = boolarg;
				types[2] = typeof(bool);
			}

            public Tuple(int opcode, org.jawk.intermediate.IHasFunctionAddress has_func_addr
				, string s2, int i3, int i4) : this(opcode)
			{
				this.has_func_addr = has_func_addr;
				strings[1] = s2;
				types[1] = typeof(string);
				ints[2] = i3;
				types[2] = typeof(int);
				ints[3] = i4;
				types[3] = typeof(int);
			}

            public Tuple(int opcode, System.Type cls)
                : this(opcode)
			{
				this.cls = cls;
				types[0] = typeof(System.Type);
			}

            public Tuple(int opcode, string s1, string s2)
                : this(opcode, s1)
			{
				strings[1] = s2;
				types[1] = typeof(string);
			}

			public void SetLineNumber(int lineno)
			{
				//assert this.lineno == -1 : "The line number was already set to "+this.lineno+".  Later lineno = "+lineno+".";
				this.lineno = lineno;
			}

			public override string ToString()
			{
				System.Text.StringBuilder sb = new System.Text.StringBuilder();
				sb.Append(ToOpcodeString(opcode));
				int idx = 0;
				while (idx < types.Length && types[idx] != null)
				{
					sb.Append(", ");
					System.Type type = types[idx];
					if (type == typeof(int))
					{
						sb.Append(ints[idx]);
					}
					else
					{
						if (type == typeof(bool))
						{
							sb.Append(bools[idx]);
						}
						else
						{
							if (type == typeof(double))
							{
								sb.Append(doubles[idx]);
							}
							else
							{
								if (type == typeof(string))
								{
									sb.Append('"').Append(strings[idx]).Append('"');
								}
								else
								{
									if (type == typeof(org.jawk.intermediate.IAddress))
									{
										//assert(idx==0);
										sb.Append(address);
									}
									else
									{
										if (type == typeof(System.Type))
										{
											//assert(idx==0);
											sb.Append(cls);
										}
										else
										{
											if (type == typeof(org.jawk.intermediate.IHasFunctionAddress))
											{
												//assert(idx==0);
												sb.Append(has_func_addr);
											}
											else
											{
												throw new System.Exception("Unknown param type (" + idx + "): " + type);
											}
										}
									}
								}
							}
						}
					}
					++idx;
				}
				return sb.ToString();
			}

			/// <summary>
			/// Update this tuple to populate the address argument value if necessary;
			/// and, check if address points to a proper element in the tuple queue.
			/// </summary>
			/// <remarks>
			/// Update this tuple to populate the address argument value if necessary;
			/// and, check if address points to a proper element in the tuple queue.
			/// <p>
			/// The address will be updated only if there exists a HasFunctionAddress
			/// argument for this tuple.
			/// <p>
			/// This is executed after the tuples are constructed so that function address
			/// references can be resolved.  Otherwise, forward declared functions will
			/// not be resolved in the Tuple list.
			/// </remarks>
			public virtual void Touch(System.Collections.Generic.IList<org.jawk.intermediate.AwkTuples.Tuple
				> queue)
			{
				//assert lineno != -1 : "The line number should have been set by queue.add(), but was not.";
				if (has_func_addr != null)
				{
					address = has_func_addr.GetFunctionAddress();
					types[0] = typeof(org.jawk.intermediate.IAddress);
				}
				if (address != null)
				{
					if (address.Index() == -1)
					{
						throw new System.Exception("address " + address + " is unresolved");
					}
					if (address.Index() >= queue.Count)
					{
						throw new System.Exception("address " + address + " doesn't resolve to an actual list element"
							);
					}
				}
			}
		}

		// private static class Tuple
		public static string ToOpcodeString(int opcode)
		{
			System.Type c = typeof(org.jawk.intermediate.AwkTuples);

            System.Reflection.FieldInfo[] fields = c.GetFields();
			try
			{
				foreach (System.Reflection.FieldInfo field in fields)
				{
					if (field.IsStatic 
                        && field.FieldType == typeof(int) 
                        && (int)field.GetValue(null) == opcode)
					{
						return field.Name;
					}
				}
			}
			catch (System.MemberAccessException iac)
			{
				Console.Error.WriteLine(iac);
				return "[" + opcode + ": " + iac + "]";
			}
			return "{" + opcode + "}";
		}

		/// <summary>Pops an item off the operand stack.</summary>
		/// <remarks>
		/// Pops an item off the operand stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _POP_ = 257;

		/// <summary>Pushes an item onto the operand stack.</summary>
		/// <remarks>
		/// Pushes an item onto the operand stack.
		/// <p>
		/// Stack before: ...<br />
		/// Stack after: x ...
		/// </remarks>
		public const int _PUSH_ = 258;

		/// <summary>
		/// Pops and evaluates the top-of-stack; if
		/// false, it jumps to a specified address.
		/// </summary>
		/// <remarks>
		/// Pops and evaluates the top-of-stack; if
		/// false, it jumps to a specified address.
		/// <p>
		/// Argument: address
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _IFFALSE_ = 259;

		/// <summary>Converts the top-of-stack to a number.</summary>
		/// <remarks>
		/// Converts the top-of-stack to a number.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: x (as a number)
		/// </remarks>
		public const int _TO_NUMBER_ = 260;

		/// <summary>
		/// Pops and evaluates the top-of-stack; if
		/// true, it jumps to a specified address.
		/// </summary>
		/// <remarks>
		/// Pops and evaluates the top-of-stack; if
		/// true, it jumps to a specified address.
		/// <p>
		/// Argument: address
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _IFTRUE_ = 261;

		/// <summary>Jumps to a specified address.</summary>
		/// <remarks>
		/// Jumps to a specified address.  The operand stack contents
		/// are unaffected.
		/// </remarks>
		public const int _GOTO_ = 262;

		/// <summary>A no-operation.</summary>
		/// <remarks>
		/// A no-operation.  The operand stack contents are
		/// unaffected.
		/// </remarks>
		public const int _NOP_ = 263;

		/// <summary>Prints N number of items that are on the operand stack.</summary>
		/// <remarks>
		/// Prints N number of items that are on the operand stack.
		/// The number of items are passed in as a tuple argument.
		/// <p>
		/// Argument: # of items (N)
		/// <p>
		/// Stack before: x1 x2 x3 .. xN ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _PRINT_ = 264;

		/// <summary>
		/// Prints N number of items that are on the operand stack to
		/// a specified file.
		/// </summary>
		/// <remarks>
		/// Prints N number of items that are on the operand stack to
		/// a specified file.  The file is passed in on the stack.
		/// The number of items are passed in as a tuple argument,
		/// as well as whether to overwrite the file or not (append mode).
		/// <p>
		/// Argument 1: # of items (N)<br />
		/// Argument 2: true = append, false = overwrite
		/// <p>
		/// Stack before: x1 x2 x3 .. xN filename ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _PRINT_TO_FILE_ = 265;

		/// <summary>
		/// Prints N number of items that are on the operand stack to
		/// a process executing a specified command (via a pipe).
		/// </summary>
		/// <remarks>
		/// Prints N number of items that are on the operand stack to
		/// a process executing a specified command (via a pipe).
		/// The command string is passed in on the stack.
		/// The number of items are passed in as a tuple argument.
		/// <p>
		/// Argument: # of items (N)
		/// <p>
		/// Stack before: x1 x2 x3 .. xN command-string ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _PRINT_TO_PIPE_ = 266;

		/// <summary>Performs a formatted print of N items that are on the operand stack.</summary>
		/// <remarks>
		/// Performs a formatted print of N items that are on the operand stack.
		/// The number of items are passed in as a tuple argument.
		/// <p>
		/// Argument: # of items (N)
		/// <p>
		/// Stack before: x1 x2 x3 .. xN ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _PRINTF_ = 267;

		/// <summary>
		/// Performs a formatted print of N items that are on the operand stack to
		/// a specified file.
		/// </summary>
		/// <remarks>
		/// Performs a formatted print of N items that are on the operand stack to
		/// a specified file.  The file is passed in on the stack.
		/// The number of items are passed in as a tuple argument,
		/// as well as whether to overwrite the file or not (append mode).
		/// <p>
		/// Argument 1: # of items (N)<br />
		/// Argument 2: true = append, false = overwrite
		/// <p>
		/// Stack before: x1 x2 x3 .. xN filename ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _PRINTF_TO_FILE_ = 268;

		/// <summary>
		/// Performs a formatted print of N items that are on the operand stack to
		/// a process executing a specified command (via a pipe).
		/// </summary>
		/// <remarks>
		/// Performs a formatted print of N items that are on the operand stack to
		/// a process executing a specified command (via a pipe).
		/// The command string is passed in on the stack.
		/// The number of items are passed in as a tuple argument.
		/// <p>
		/// Argument: # of items (N)
		/// <p>
		/// Stack before: x1 x2 x3 .. xN command-string ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _PRINTF_TO_PIPE_ = 269;

		public const int _SPRINTF_ = 270;

		/// <summary>
		/// Depending on the argument, pop and evaluate the string length of the top-of-stack
		/// or evaluate the string length of $0; in either case, push the result onto
		/// the stack.
		/// </summary>
		/// <remarks>
		/// Depending on the argument, pop and evaluate the string length of the top-of-stack
		/// or evaluate the string length of $0; in either case, push the result onto
		/// the stack.
		/// <p>
		/// The input field length evaluation mode is provided to support backward
		/// compatibility with the deprecated usage of length (i.e., no arguments).
		/// <p>
		/// Argument: 0 to use $0, use top-of-stack otherwise
		/// <p>
		/// If argument is 0:
		/// <blockquote>
		/// Stack before: ...<br />
		/// Stack after: length-of-$0 ...
		/// </blockquote>
		/// else
		/// <blockquote>
		/// Stack before: x ...<br />
		/// Stack after: length-of-x ...
		/// </blockquote>
		/// </remarks>
		public const int _LENGTH_ = 271;

		/// <summary>
		/// Pop and concatinate two strings from the top-of-stack; push the result onto
		/// the stack.
		/// </summary>
		/// <remarks>
		/// Pop and concatinate two strings from the top-of-stack; push the result onto
		/// the stack.
		/// <p>
		/// Stack before: x y ...<br />
		/// Stack after: x-concatenated-with-y ...
		/// </remarks>
		public const int _CONCAT_ = 272;

		/// <summary>Assigns the top-of-stack to a variable.</summary>
		/// <remarks>
		/// Assigns the top-of-stack to a variable.  The contents of the stack
		/// are unaffected.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: x ...
		/// </remarks>
		public const int _ASSIGN_ = 273;

		/// <summary>Assigns an item to an array element.</summary>
		/// <remarks>
		/// Assigns an item to an array element.  The item remains on the stack.
		/// <p>
		/// Argument 1: offset of the particular associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: index-into-array item ...<br />
		/// Stack after: item ...
		/// </remarks>
		public const int _ASSIGN_ARRAY_ = 274;

		/// <summary>Assigns the top-of-stack to $0.</summary>
		/// <remarks>
		/// Assigns the top-of-stack to $0.  The contents of the stack are unaffected.
		/// Upon assignment, individual field variables are recalculated.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: x ...
		/// </remarks>
		public const int _ASSIGN_AS_INPUT_ = 275;

		/// <summary>Assigns an item as a particular input field; the field number can be 0.</summary>
		/// <remarks>
		/// Assigns an item as a particular input field; the field number can be 0.
		/// Upon assignment, associating input fields are affected.  For example, if
		/// the following assignment were made:
		/// <blockquote>
		/// <pre>
		/// $3 = "hi"
		/// </pre>
		/// </blockquote>
		/// $0 would be recalculated.  Likewise, if the following assignment were made:
		/// <blockquote>
		/// <pre>
		/// $0 = "hello there"
		/// </pre>
		/// </blockquote>
		/// $1, $2, ... would be recalculated.
		/// <p>
		/// Stack before: field-num x ...<br />
		/// Stack after: x ...
		/// </remarks>
		public const int _ASSIGN_AS_INPUT_FIELD_ = 276;

		/// <summary>Obtains an item from the variable manager and push it onto the stack.</summary>
		/// <remarks>
		/// Obtains an item from the variable manager and push it onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: ...<br />
		/// Stack after: x ...
		/// </remarks>
		public const int _DEREFERENCE_ = 277;

		/// <summary>
		/// Increase the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Increase the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: n ...<br />
		/// Stack after: x+n ...
		/// </remarks>
		public const int _PLUS_EQ_ = 278;

		/// <summary>
		/// Decreases the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Decreases the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: n ...<br />
		/// Stack after: x-n ...
		/// </remarks>
		public const int _MINUS_EQ_ = 279;

		/// <summary>
		/// Multiplies the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Multiplies the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: n ...<br />
		/// Stack after: x*n ...
		/// </remarks>
		public const int _MULT_EQ_ = 280;

		/// <summary>
		/// Divides the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Divides the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: n ...<br />
		/// Stack after: x/n ...
		/// </remarks>
		public const int _DIV_EQ_ = 281;

		/// <summary>
		/// Takes the modulues of the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Takes the modulues of the contents of the variable by an adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: n ...<br />
		/// Stack after: x%n ...
		/// </remarks>
		public const int _MOD_EQ_ = 282;

		/// <summary>
		/// Raises the contents of the variable to the power of the adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Raises the contents of the variable to the power of the adjustment value;
		/// assigns the result to the variable and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: n ...<br />
		/// Stack after: x^n ...
		/// </remarks>
		public const int _POW_EQ_ = 283;

		/// <summary>
		/// Increase the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Increase the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx n ...<br />
		/// Stack after: x+n ...
		/// </remarks>
		public const int _PLUS_EQ_ARRAY_ = 284;

		/// <summary>
		/// Decreases the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Decreases the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx n ...<br />
		/// Stack after: x-n ...
		/// </remarks>
		public const int _MINUS_EQ_ARRAY_ = 285;

		/// <summary>
		/// Multiplies the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Multiplies the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx n ...<br />
		/// Stack after: x*n ...
		/// </remarks>
		public const int _MULT_EQ_ARRAY_ = 286;

		/// <summary>
		/// Divides the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Divides the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx n ...<br />
		/// Stack after: x/n ...
		/// </remarks>
		public const int _DIV_EQ_ARRAY_ = 287;

		/// <summary>
		/// Takes the modulus of the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Takes the modulus of the contents of an indexed array by an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx n ...<br />
		/// Stack after: x%n ...
		/// </remarks>
		public const int _MOD_EQ_ARRAY_ = 288;

		/// <summary>
		/// Raises the contents of an indexed array to the power of an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Raises the contents of an indexed array to the power of an adjustment value;
		/// assigns the result to the array and pushes the result onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx n ...<br />
		/// Stack after: x^n ...
		/// </remarks>
		public const int _POW_EQ_ARRAY_ = 289;

		/// <summary>
		/// Increases the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Increases the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// <p>
		/// Stack before: input-field_number n ...<br />
		/// Stack after: x+n ...
		/// </remarks>
		public const int _PLUS_EQ_INPUT_FIELD_ = 290;

		/// <summary>
		/// Decreases the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Decreases the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// <p>
		/// Stack before: input-field_number n ...<br />
		/// Stack after: x-n ...
		/// </remarks>
		public const int _MINUS_EQ_INPUT_FIELD_ = 291;

		/// <summary>
		/// Multiplies the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Multiplies the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// <p>
		/// Stack before: input-field_number n ...<br />
		/// Stack after: x*n ...
		/// </remarks>
		public const int _MULT_EQ_INPUT_FIELD_ = 292;

		/// <summary>
		/// Divides the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Divides the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// <p>
		/// Stack before: input-field_number n ...<br />
		/// Stack after: x/n ...
		/// </remarks>
		public const int _DIV_EQ_INPUT_FIELD_ = 293;

		/// <summary>
		/// Takes the modulus of the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Takes the modulus of the contents of an input field by an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// <p>
		/// Stack before: input-field_number n ...<br />
		/// Stack after: x%n ...
		/// </remarks>
		public const int _MOD_EQ_INPUT_FIELD_ = 294;

		/// <summary>
		/// Raises the contents of an input field to the power of an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Raises the contents of an input field to the power of an adjustment value;
		/// assigns the result to the input field and pushes the result onto the stack.
		/// <p>
		/// Stack before: input-field_number n ...<br />
		/// Stack after: x^n ...
		/// </remarks>
		public const int _POW_EQ_INPUT_FIELD_ = 295;

		/// <summary>Seeds the random number generator.</summary>
		/// <remarks>
		/// Seeds the random number generator.  If there are no arguments, the current
		/// time (as a long value) is used as the seed.  Otherwise, the top-of-stack is
		/// popped and used as the seed value.
		/// <p>
		/// Argument: # of arguments
		/// <p>
		/// If # of arguments is 0:
		/// <blockquote>
		/// Stack before: ...<br />
		/// Stack after: old-seed ...
		/// </blockquote>
		/// else
		/// <blockquote>
		/// Stack before: x ...<br />
		/// Stack after: old-seed ...
		/// </blockquote>
		/// </remarks>
		public const int _SRAND_ = 296;

		/// <summary>
		/// Obtains the next random number from the random number generator
		/// and push it onto the stack.
		/// </summary>
		/// <remarks>
		/// Obtains the next random number from the random number generator
		/// and push it onto the stack.
		/// <p>
		/// Stack before: ...<br />
		/// Stack after: random-number ...
		/// </remarks>
		public const int _RAND_ = 297;

		/// <summary>
		/// Built-in function that pops the top-of-stack, removes its fractional part,
		/// if any, and places the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pops the top-of-stack, removes its fractional part,
		/// if any, and places the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: (int)x ...
		/// </remarks>
		public const int _INTFUNC_ = 298;

		/// <summary>
		/// Built-in function that pops the top-of-stack, takes its square root,
		/// and places the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pops the top-of-stack, takes its square root,
		/// and places the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: sqrt(x) ...
		/// </remarks>
		public const int _SQRT_ = 299;

		/// <summary>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.log method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.log method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: log(x) ...
		/// </remarks>
		public const int _LOG_ = 300;

		/// <summary>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.exp method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.exp method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: exp(x) ...
		/// </remarks>
		public const int _EXP_ = 301;

		/// <summary>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.sin method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.sin method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: sin(x) ...
		/// </remarks>
		public const int _SIN_ = 302;

		/// <summary>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.cos method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pops the top-of-stack, calls the java.lang.Math.cos method
		/// with the top-of-stack as the argument, and places the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: cos(x) ...
		/// </remarks>
		public const int _COS_ = 303;

		/// <summary>
		/// Built-in function that pops the first two items off the stack, calls the java.lang.Math.atan2 method
		/// with these as arguments, and places the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pops the first two items off the stack, calls the java.lang.Math.atan2 method
		/// with these as arguments, and places the result onto the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: atan2(x1,x2) ...
		/// </remarks>
		public const int _ATAN2_ = 304;

		/// <summary>
		/// Built-in function that searches a string as input to a regular expression,
		/// the location of the match is pushed onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that searches a string as input to a regular expression,
		/// the location of the match is pushed onto the stack.
		/// The RSTART and RLENGTH variables are set as a side effect.
		/// If a match is found, RSTART and function return value are set
		/// to the location of the match and RLENGTH is set to the length
		/// of the substring matched against the regular expression.
		/// If no match is found, RSTART (and return value) is set to
		/// 0 and RLENGTH is set to -1.
		/// <p>
		/// Stack before: string regexp ...<br />
		/// Stack after: RSTART ...
		/// </remarks>
		public const int _MATCH_ = 305;

		/// <summary>
		/// Built-in function that locates a substring within a source string
		/// and pushes the location onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that locates a substring within a source string
		/// and pushes the location onto the stack.  If the substring is
		/// not found, 0 is pushed onto the stack.
		/// <p>
		/// Stack before: string substring ...<br />
		/// Stack after: location-index ...
		/// </remarks>
		public const int _INDEX_ = 306;

		/// <summary>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in $0 and replaces it with another.
		/// </summary>
		/// <remarks>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in $0 and replaces it with another.
		/// <p>
		/// Argument: true if global sub, false otherwise.
		/// <p>
		/// Stack before: regexp replacement-string ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _SUB_FOR_DOLLAR_0_ = 307;

		/// <summary>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in a field reference and replaces it with another.
		/// </summary>
		/// <remarks>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in a field reference and replaces it with another.
		/// <p>
		/// Argument: true if global sub, false otherwise.
		/// <p>
		/// Stack before: field-num regexp replacement-string ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _SUB_FOR_DOLLAR_REFERENCE_ = 308;

		/// <summary>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in a particular variable and replaces it with another.
		/// </summary>
		/// <remarks>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in a particular variable and replaces it with another.
		/// <p>
		/// Argument 1: variable offset in variable manager<br />
		/// Argument 2: is global variable<br />
		/// Argument 3: is global sub
		/// <p>
		/// Stack before: regexp replacement-string orig-string ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _SUB_FOR_VARIABLE_ = 309;

		/// <summary>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in a particular array cell and replaces it with another.
		/// </summary>
		/// <remarks>
		/// Built-in function that substitutes an occurance (or all occurances)
		/// of a string in a particular array cell and replaces it with another.
		/// <p>
		/// Argument 1: array map offset in variable manager<br />
		/// Argument 2: is global array map<br />
		/// Argument 3: is global sub
		/// <p>
		/// Stack before: array-index regexp replacement-string orig-string ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _SUB_FOR_ARRAY_REFERENCE_ = 310;

		/// <summary>
		/// Built-in function to split a string by a regexp and put the
		/// components into an array.
		/// </summary>
		/// <remarks>
		/// Built-in function to split a string by a regexp and put the
		/// components into an array.
		/// <p>
		/// Argument: # of arguments (parameters on stack)
		/// <p>
		/// If # of arguments is 2:
		/// <blockquote>
		/// Stack before: string array ...<br />
		/// Stack after: n ...
		/// </blockquote>
		/// else
		/// <blockquote>
		/// Stack before: string array regexp ...<br />
		/// Stack after: n ...
		/// </blockquote>
		/// </remarks>
		public const int _SPLIT_ = 311;

		/// <summary>
		/// Built-in function that pushes a substring of the top-of-stack
		/// onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that pushes a substring of the top-of-stack
		/// onto the stack.
		/// The tuple argument indicates whether to limit the substring
		/// to a particular end position, or to take the substring
		/// up to the end-of-string.
		/// <p>
		/// Argument: # of arguments
		/// <p>
		/// If # of arguments is 2:
		/// <blockquote>
		/// Stack before: string startpos ...<br />
		/// Stack after: substring ...
		/// </blockquote>
		/// else
		/// <blockquote>
		/// Stack before: string startpos endpos ...<br />
		/// Stack after: substring ...
		/// </blockquote>
		/// </remarks>
		public const int _SUBSTR_ = 312;

		/// <summary>
		/// Built-in function that converts all the letters in the top-of-stack
		/// to lower case and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that converts all the letters in the top-of-stack
		/// to lower case and pushes the result onto the stack.
		/// <p>
		/// Stack before: STRING-ARGUMENT ...<br />
		/// Stack after: string-argument ...
		/// </remarks>
		public const int _TOLOWER_ = 313;

		/// <summary>
		/// Built-in function that converts all the letters in the top-of-stack
		/// to upper case and pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that converts all the letters in the top-of-stack
		/// to upper case and pushes the result onto the stack.
		/// <p>
		/// Stack before: string-argument ...<br />
		/// Stack after: STRING-ARGUMENT ...
		/// </remarks>
		public const int _TOUPPER_ = 314;

		/// <summary>
		/// Built-in function that executes the top-of-stack as a system command
		/// and pushes the return code onto the stack.
		/// </summary>
		/// <remarks>
		/// Built-in function that executes the top-of-stack as a system command
		/// and pushes the return code onto the stack.
		/// <p>
		/// Stack before: cmd ...<br />
		/// Stack after: return-code ...
		/// </remarks>
		public const int _SYSTEM_ = 315;

		/// <summary>Swaps the top two elements of the stack.</summary>
		/// <remarks>
		/// Swaps the top two elements of the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x2 x1 ...
		/// </remarks>
		public const int _SWAP_ = 316;

		/// <summary>
		/// Numerically adds the top two elements of the stack with the result
		/// pushed onto the stack.
		/// </summary>
		/// <remarks>
		/// Numerically adds the top two elements of the stack with the result
		/// pushed onto the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1+x2 ...
		/// </remarks>
		public const int _ADD_ = 317;

		/// <summary>
		/// Numerically subtracts the top two elements of the stack with the result
		/// pushed onto the stack.
		/// </summary>
		/// <remarks>
		/// Numerically subtracts the top two elements of the stack with the result
		/// pushed onto the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1-x2 ...
		/// </remarks>
		public const int _SUBTRACT_ = 318;

		/// <summary>
		/// Numerically multiplies the top two elements of the stack with the result
		/// pushed onto the stack.
		/// </summary>
		/// <remarks>
		/// Numerically multiplies the top two elements of the stack with the result
		/// pushed onto the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1*x2 ...
		/// </remarks>
		public const int _MULTIPLY_ = 319;

		/// <summary>
		/// Numerically divides the top two elements of the stack with the result
		/// pushed onto the stack.
		/// </summary>
		/// <remarks>
		/// Numerically divides the top two elements of the stack with the result
		/// pushed onto the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1/x2 ...
		/// </remarks>
		public const int _DIVIDE_ = 320;

		/// <summary>
		/// Numerically takes the modulus of the top two elements of the stack with the result
		/// pushed onto the stack.
		/// </summary>
		/// <remarks>
		/// Numerically takes the modulus of the top two elements of the stack with the result
		/// pushed onto the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1%x2 ...
		/// </remarks>
		public const int _MOD_ = 321;

		/// <summary>
		/// Numerically raises the top element to the power of the next element with the result
		/// pushed onto the stack.
		/// </summary>
		/// <remarks>
		/// Numerically raises the top element to the power of the next element with the result
		/// pushed onto the stack.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1^x2 ...
		/// </remarks>
		public const int _POW_ = 322;

		/// <summary>
		/// Increases the variable reference by one; pushes the result
		/// onto the stack.
		/// </summary>
		/// <remarks>
		/// Increases the variable reference by one; pushes the result
		/// onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: ...<br />
		/// Stack after: x+1 ...
		/// </remarks>
		public const int _INC_ = 323;

		/// <summary>
		/// Decreases the variable reference by one; pushes the result
		/// onto the stack.
		/// </summary>
		/// <remarks>
		/// Decreases the variable reference by one; pushes the result
		/// onto the stack.
		/// <p>
		/// Argument 1: offset of the particular variable into the variable manager<br />
		/// Argument 2: whether the variable is global or local
		/// <p>
		/// Stack before: ...<br />
		/// Stack after: x-1 ...
		/// </remarks>
		public const int _DEC_ = 324;

		/// <summary>
		/// Increases the array element reference by one; pushes the result
		/// onto the stack.
		/// </summary>
		/// <remarks>
		/// Increases the array element reference by one; pushes the result
		/// onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx ...<br />
		/// Stack after: x+1 ...
		/// </remarks>
		public const int _INC_ARRAY_REF_ = 325;

		/// <summary>
		/// Decreases the array element reference by one; pushes the result
		/// onto the stack.
		/// </summary>
		/// <remarks>
		/// Decreases the array element reference by one; pushes the result
		/// onto the stack.
		/// <p>
		/// Argument 1: offset of the associative array into the variable manager<br />
		/// Argument 2: whether the associative array is global or local
		/// <p>
		/// Stack before: array-idx ...<br />
		/// Stack after: x-1 ...
		/// </remarks>
		public const int _DEC_ARRAY_REF_ = 326;

		/// <summary>
		/// Increases the input field variable by one; pushes the result
		/// onto the stack.
		/// </summary>
		/// <remarks>
		/// Increases the input field variable by one; pushes the result
		/// onto the stack.
		/// <p>
		/// Stack before: field-idx ...<br />
		/// Stack after: x+1
		/// </remarks>
		public const int _INC_DOLLAR_REF_ = 327;

		/// <summary>
		/// Decreases the input field variable by one; pushes the result
		/// onto the stack.
		/// </summary>
		/// <remarks>
		/// Decreases the input field variable by one; pushes the result
		/// onto the stack.
		/// <p>
		/// Stack before: field-idx ...<br />
		/// Stack after: x-1
		/// </remarks>
		public const int _DEC_DOLLAR_REF_ = 328;

		/// <summary>Duplicates the top-of-stack on the stack.</summary>
		/// <remarks>
		/// Duplicates the top-of-stack on the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: x x ...
		/// </remarks>
		public const int _DUP_ = 329;

		/// <summary>
		/// Evaluates the logical NOT of the top stack element;
		/// pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Evaluates the logical NOT of the top stack element;
		/// pushes the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: !x ...
		/// </remarks>
		public const int _NOT_ = 330;

		/// <summary>
		/// Evalutes the numerical NEGATION of the top stack element;
		/// pushes the result onto the stack.
		/// </summary>
		/// <remarks>
		/// Evalutes the numerical NEGATION of the top stack element;
		/// pushes the result onto the stack.
		/// <p>
		/// Stack before: x ...<br />
		/// Stack after: -x ...
		/// </remarks>
		public const int _NEGATE_ = 331;

		/// <summary>Compares the top two stack elements; pushes 1 onto the stack if equal, 0 if not equal.
		/// 	</summary>
		/// <remarks>
		/// Compares the top two stack elements; pushes 1 onto the stack if equal, 0 if not equal.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1==x2
		/// </remarks>
		public const int _CMP_EQ_ = 332;

		/// <summary>Compares the top two stack elements; pushes 1 onto the stack if x1 &lt; x2, 0 if not equal.
		/// 	</summary>
		/// <remarks>
		/// Compares the top two stack elements; pushes 1 onto the stack if x1 &lt; x2, 0 if not equal.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1&lt;x2
		/// </remarks>
		public const int _CMP_LT_ = 333;

		/// <summary>Compares the top two stack elements; pushes 1 onto the stack if x1 &gt; x2, 0 if not equal.
		/// 	</summary>
		/// <remarks>
		/// Compares the top two stack elements; pushes 1 onto the stack if x1 &gt; x2, 0 if not equal.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: x1&gt;x2
		/// </remarks>
		public const int _CMP_GT_ = 334;

		/// <summary>
		/// Applies a regular expression to the top stack element; pushes 1 if it matches,
		/// 0 if it does not match.
		/// </summary>
		/// <remarks>
		/// Applies a regular expression to the top stack element; pushes 1 if it matches,
		/// 0 if it does not match.
		/// <p>
		/// Stack before: x1 x2 ...<br />
		/// Stack after: (x1 ~ /x2/) ...
		/// </remarks>
		public const int _MATCHES_ = 335;

		/// <summary><strong>Extension:</strong> Pauses the execution thread by N number of seconds.
		/// 	</summary>
		/// <remarks>
		/// <strong>Extension:</strong> Pauses the execution thread by N number of seconds.
		/// <p>
		/// Stack before: N ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _SLEEP_ = 336;

		public const int _DUMP_ = 337;

		public const int _DEREF_ARRAY_ = 338;

		/// <summary>Retrieves and pushes a Set of keys from an associative array onto the stack.
		/// 	</summary>
		/// <remarks>
		/// Retrieves and pushes a Set of keys from an associative array onto the stack.
		/// The Set is tagged with a KeyList interface.
		/// <p>
		/// Stack before: associative-array ...<br />
		/// Stack after: keylist-set ...
		/// </remarks>
		public const int _KEYLIST_ = 339;

		/// <summary>
		/// Tests whether the KeyList (set) is empty; jumps to the argument
		/// address if empty, steps to the next instruction if not.
		/// </summary>
		/// <remarks>
		/// Tests whether the KeyList (set) is empty; jumps to the argument
		/// address if empty, steps to the next instruction if not.
		/// <p>
		/// Argument: jump-address-if-empty
		/// <p>
		/// Stack before: keylist ...<br />
		/// Stack after: ...
		/// </remarks>
		public const int _IS_EMPTY_KEYLIST_ = 340;

		/// <summary>Removes an item from the KeyList (set) and pushes it onto the operand stack.
		/// 	</summary>
		/// <remarks>
		/// Removes an item from the KeyList (set) and pushes it onto the operand stack.
		/// <p>
		/// Stack before: keylist ...<br />
		/// Stack after: 1st-item ...
		/// </remarks>
		public const int _GET_FIRST_AND_REMOVE_FROM_KEYLIST_ = 341;

		/// <summary>
		/// Checks whether the top-of-stack is of a particular class type;
		/// if not, an AwkRuntimeException is thrown.
		/// </summary>
		/// <remarks>
		/// Checks whether the top-of-stack is of a particular class type;
		/// if not, an AwkRuntimeException is thrown.
		/// The stack remains unchanged upon a successful check.
		/// <p>
		/// Argument: class-type (i.e., KeyList.class)
		/// <p>
		/// Stack before: obj ...<br />
		/// Stack after: obj ...
		/// </remarks>
		public const int _CHECK_CLASS_ = 342;

		/// <summary>Push an input field onto the stack.</summary>
		/// <remarks>
		/// Push an input field onto the stack.
		/// <p>
		/// Stack before: field-id ...<br />
		/// Stack after: x ...
		/// </remarks>
		public const int _GET_INPUT_FIELD_ = 343;

		/// <summary>Consume next line of input; assigning $0 and recalculating $1, $2, etc.</summary>
		/// <remarks>
		/// Consume next line of input; assigning $0 and recalculating $1, $2, etc.
		/// The input can come from the following sources:
		/// <ul>
		/// <li>stdin
		/// <li>filename arguments
		/// </ul>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _CONSUME_INPUT_ = 344;

		/// <summary>
		/// Obtains input from stdin/filename-args and pushes
		/// input line and status code onto the stack.
		/// </summary>
		/// <remarks>
		/// Obtains input from stdin/filename-args and pushes
		/// input line and status code onto the stack.
		/// The input is partitioned into records based on the RS variable
		/// assignment as a regular expression.
		/// <p>
		/// If there is input available, the input string and a return code
		/// of 1 is pushed.  If EOF is reached, a blank (null) string ("")
		/// is pushed along with a 0 return code.  Upon an IO error,
		/// a blank string and a -1 is pushed onto the operand stack.
		/// <p>
		/// Stack before: ...<br />
		/// Stack after: input-string return-code ...
		/// </remarks>
		public const int _GETLINE_INPUT_ = 345;

		/// <summary>
		/// Obtains input from a file and pushes
		/// input line and status code onto the stack.
		/// </summary>
		/// <remarks>
		/// Obtains input from a file and pushes
		/// input line and status code onto the stack.
		/// The input is partitioned into records based on the RS variable
		/// assignment as a regular expression.
		/// <p>
		/// Upon initial execution, the file is opened and the handle
		/// is maintained until it is explicitly closed, or until
		/// the VM exits.  Subsequent calls will obtain subsequent
		/// lines (records) of input until no more records are available.
		/// <p>
		/// If there is input available, the input string and a return code
		/// of 1 is pushed.  If EOF is reached, a blank (null) string ("")
		/// is pushed along with a 0 return code.  Upon an IO error,
		/// a blank string and a -1 is pushed onto the operand stack.
		/// <p>
		/// Stack before: filename ...<br />
		/// Stack after: input-string return-code ...
		/// </remarks>
		public const int _USE_AS_FILE_INPUT_ = 346;

		/// <summary>
		/// Obtains input from a command (process) and pushes
		/// input line and status code onto the stack.
		/// </summary>
		/// <remarks>
		/// Obtains input from a command (process) and pushes
		/// input line and status code onto the stack.
		/// The input is partitioned into records based on the RS variable
		/// assignment as a regular expression.
		/// <p>
		/// Upon initial execution, the a process is spawned to execute
		/// the specified command and the process reference
		/// is maintained until it is explicitly closed, or until
		/// the VM exits.  Subsequent calls will obtain subsequent
		/// lines (records) of input until no more records are available.
		/// <p>
		/// If there is input available, the input string and a return code
		/// of 1 is pushed.  If EOF is reached, a blank (null) string ("")
		/// is pushed along with a 0 return code.  Upon an IO error,
		/// a blank string and a -1 is pushed onto the operand stack.
		/// <p>
		/// Stack before: command-line ...<br />
		/// Stack after: input-string return-code ...
		/// </remarks>
		public const int _USE_AS_COMMAND_INPUT_ = 347;

		/// <summary>Assign the NF variable offset.</summary>
		/// <remarks>
		/// Assign the NF variable offset.  This is important for the
		/// AVM to set the variables as new input lines are processed.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _NF_OFFSET_ = 348;

		/// <summary>Assign the NR variable offset.</summary>
		/// <remarks>
		/// Assign the NR variable offset.  This is important for the
		/// AVM to increase the record number as new input lines received.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _NR_OFFSET_ = 349;

		/// <summary>Assign the FNR variable offset.</summary>
		/// <remarks>
		/// Assign the FNR variable offset.  This is important for the
		/// AVM to increase the "file" record number as new input lines are received.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _FNR_OFFSET_ = 350;

		/// <summary>Assign the FS variable offset.</summary>
		/// <remarks>
		/// Assign the FS variable offset.  This is important for the
		/// AVM to know how to split fields upon incoming records of input.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _FS_OFFSET_ = 351;

		/// <summary>Assign the RS variable offset.</summary>
		/// <remarks>
		/// Assign the RS variable offset.  This is important for the
		/// AVM to know how to create records from the stream(s) of input.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _RS_OFFSET_ = 352;

		/// <summary>Assign the OFS variable offset.</summary>
		/// <remarks>
		/// Assign the OFS variable offset.  This is important for the
		/// AVM to use when outputting expressions via PRINT.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _OFS_OFFSET_ = 353;

		/// <summary>Assign the RSTART variable offset.</summary>
		/// <remarks>
		/// Assign the RSTART variable offset.  The AVM sets this variable while
		/// executing the match() builtin function.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _RSTART_OFFSET_ = 354;

		/// <summary>Assign the RLENGTH variable offset.</summary>
		/// <remarks>
		/// Assign the RLENGTH variable offset.  The AVM sets this variable while
		/// executing the match() builtin function.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _RLENGTH_OFFSET_ = 355;

		/// <summary>Assign the FILENAME variable offset.</summary>
		/// <remarks>
		/// Assign the FILENAME variable offset.  The AVM sets this variable while
		/// processing files from the command-line for input.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _FILENAME_OFFSET_ = 356;

		/// <summary>Assign the SUBSEP variable offset.</summary>
		/// <remarks>
		/// Assign the SUBSEP variable offset.  The AVM uses this variable while
		/// building an index of a multi-dimensional array.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _SUBSEP_OFFSET_ = 357;

		/// <summary>Assign the CONVFMT variable offset.</summary>
		/// <remarks>
		/// Assign the CONVFMT variable offset.  The AVM uses this variable while
		/// converting numbers to strings.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _CONVFMT_OFFSET_ = 358;

		/// <summary>Assign the OFMT variable offset.</summary>
		/// <remarks>
		/// Assign the OFMT variable offset.  The AVM uses this variable while
		/// converting numbers to strings for printing.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _OFMT_OFFSET_ = 359;

		/// <summary>Assign the ENVIRON variable offset.</summary>
		/// <remarks>
		/// Assign the ENVIRON variable offset.  The AVM provides environment
		/// variables through this array.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _ENVIRON_OFFSET_ = 360;

		/// <summary>Assign the ARGC variable offset.</summary>
		/// <remarks>
		/// Assign the ARGC variable offset.  The AVM provides the number of
		/// arguments via this variable.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _ARGC_OFFSET_ = 361;

		/// <summary>Assign the ARGV variable offset.</summary>
		/// <remarks>
		/// Assign the ARGV variable offset.  The AVM provides command-line
		/// arguments via this variable.
		/// <p>
		/// The operand stack is unaffected.
		/// </remarks>
		public const int _ARGV_OFFSET_ = 362;

		/// <summary>
		/// Apply the RS variable by notifying the partitioning reader that
		/// there is a new regular expression to use when partitioning input
		/// records.
		/// </summary>
		/// <remarks>
		/// Apply the RS variable by notifying the partitioning reader that
		/// there is a new regular expression to use when partitioning input
		/// records.
		/// <p>
		/// The stack remains unaffected.
		/// </remarks>
		public const int _APPLY_RS_ = 363;

		public const int _CALL_FUNCTION_ = 364;

		public const int _FUNCTION_ = 365;

		public const int _SET_RETURN_RESULT_ = 366;

		public const int _RETURN_FROM_FUNCTION_ = 367;

		public const int _SET_NUM_GLOBALS_ = 368;

		public const int _CLOSE_ = 369;

		public const int _APPLY_SUBSEP_ = 370;

		public const int _DELETE_ARRAY_ELEMENT_ = 371;

		public const int _SET_EXIT_ADDRESS_ = 372;

		public const int _SET_WITHIN_END_BLOCKS_ = 373;

		public const int _EXIT_WITH_CODE_ = 374;

		public const int _REGEXP_ = 375;

		public const int _REGEXP_PAIR_ = 376;

		public const int _IS_IN_ = 377;

		public const int _CAST_INT_ = 378;

		public const int _CAST_DOUBLE_ = 379;

		public const int _CAST_STRING_ = 380;

		public const int _THIS_ = 381;

		public const int _EXTENSION_ = 382;

		public const int _EXEC_ = 383;

		public const int _DELETE_ARRAY_ = 384;

		private sealed class _List_1340 : System.Collections.Generic.IList<AwkTuples.Tuple>
		{
			public _List_1340(AwkTuples _enclosing, int baseArg1)
			{
                mList = new List<Tuple>(baseArg1);
				this._enclosing = _enclosing;
			}

			// made public to be accessable via Java Reflection
			// (see toOpcodeString() method above)
			// x -> 0
			// 0 -> x
			// x -> 0
			// x1 -> x2
			// x -> 0
			// 0 -> 0
			// 0 -> 0
			// x1, x2, ... xn -> 0
			// x1, x2, ... xn -> 0
			// x1, x2, ... xn -> 0
			// x1, x2, ... xn -> 0
			// x1, x2, ... xn -> 0
			// x1, x2, ... xn -> 0
			// x1, x2, ... xn -> 0
			// 0 -> x or x1 -> x2
			// x2, x1 -> x1x2
			// x -> 0
			// x2, x1 -> 0
			// x -> 0
			// x, y -> x
			// 0 -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x1,x2 -> x
			// x1,x2 -> x
			// x1,x2 -> x
			// x1,x2 -> x
			// x1,x2 -> x
			// x1,x2 -> x
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1, x2
			// x1, x2 -> x
			// x1, x2 -> x
			// x -> 0
			// x -> 0
			// x -> 0
			// x -> 0
			// x1 -> x2
			// x1 -> x2
			// x1 -> x2
			// x1 -> x2
			// x1 -> x2
			// x2, x1 -> x1, x2
			// x2, x1 -> x1+x2
			// x2, x1 -> x1-x2
			// x2, x1 -> x1*x2
			// x2, x1 -> x1/x2
			// x2, x1 -> x1/x2
			// x2, x1 -> x1/x2
			// 0 -> x
			// 0 -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x
			// x -> x, x
			// x -> !x
			// x -> -x
			// x2, x1 -> x1 == x2
			// x2, x1 -> x1 < x2
			// x2, x1 -> x1 < x2
			// x2, x1 -> x1 ~ x2
			// x -> 0
			// x -> 0
			// x -> x
			// for (x in y) {keyset} support
			// 0 -> {keylist}
			// {keylist} -> 0
			// {keylist} -> x
			// assertions
			// {class} -> 0
			// input
			//* Obtain an input string from stdin; push the result onto the stack.
			// 0 -> x
			// 0 -> 0
			// 0 -> x
			// x1 -> x2
			// x1 -> x2
			// variable housekeeping
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// x1,x2,...,xn -> x
			// x1,x2,...,xn -> x
			// x -> 0
			// 0 -> 0
			// 0 -> 0
			// x -> 0
			// x -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> 0
			// 0 -> x
			// 0 -> x
			// x,y -> x
			// x -> (int)x
			// x -> (double)x
			// x -> (string)x
			// 0 -> (this)
			// x1,x2,...,xn -> x
			// x1,x2,...,xn -> x
			// 0 -> 0
			public void Add(org.jawk.intermediate.AwkTuples.Tuple t)
			{
				t.SetLineNumber(this._enclosing.lineno_stack.Peek());
				mList.Add(t);
			}

			private readonly AwkTuples _enclosing;

            #region IList<Tuple> Members
            private System.Collections.Generic.List<Tuple> mList = null;

            public int IndexOf(Tuple item)
            {
                return mList.IndexOf(item);
            }

            public void Insert(int index, Tuple item)
            {
                mList.Insert(index,item);
            }

            public void RemoveAt(int index)
            {
                mList.RemoveAt(index);
            }

            public Tuple this[int index]
            {
                get
                {
                    return mList[index];
                }
                set
                {
                    mList[index] = value;
                }
            }

            #endregion

            #region ICollection<Tuple> Members


            public void Clear()
            {
                mList.Clear();
            }

            public bool Contains(Tuple item)
            {
                return mList.Contains(item);
            }

            public void CopyTo(Tuple[] array, int arrayIndex)
            {
                mList.CopyTo(array,arrayIndex);
            }

            public int Count
            {
                get { return mList.Count; }
            }

            public bool IsReadOnly
            {
                get { return false; }
            }

            public bool Remove(Tuple item)
            {
                return mList.Remove(item);
            }

            #endregion

            #region IEnumerable<Tuple> Members

            public System.Collections.Generic.IEnumerator<Tuple> GetEnumerator()
            {
                return mList.GetEnumerator();
            }

            #endregion

            #region IEnumerable Members

            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
            {
                return mList.GetEnumerator();
            }

            #endregion
        }

		/// <summary>
		/// add() subclassed to populate the line number for each tuple,
		/// rather than polluting all the constructors with this assignment.
		/// </summary>
		/// <remarks>
		/// add() subclassed to populate the line number for each tuple,
		/// rather than polluting all the constructors with this assignment.
		/// </remarks>
		private System.Collections.Generic.IList<org.jawk.intermediate.AwkTuples.Tuple> queue;

		private System.Collections.Generic.ICollection<org.jawk.intermediate.IAddress> unresolved_addresses
			 = new List<IAddress>();

		/// <summary>Needed only for dumping intermediate code to text such that address labels are provided.
		/// 	</summary>
		/// <remarks>Needed only for dumping intermediate code to text such that address labels are provided.
		/// 	</remarks>
		private System.Collections.Generic.IDictionary<int, org.jawk.intermediate.IAddress
			> address_indexes = new System.Collections.Generic.Dictionary<int, org.jawk.intermediate.IAddress
			>();

		private System.Collections.Generic.IDictionary<string, int> address_label_counts = 
			new System.Collections.Generic.Dictionary<string, int>();

		public virtual void Pop()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_POP_));
		}

		public virtual void Push(object o)
		{
			//assert (o instanceof String) || (o instanceof Integer) || (o instanceof Double); //  || (o instanceof Pattern); //  || (o instanceof PatternPair);
			if (o is string)
			{
				queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PUSH_, o.ToString()));
			}
			else
			{
				if (o is int)
				{
					queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PUSH_, (int)o));
				}
				else
				{
					if (o is double)
					{
						queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PUSH_, (double)o));
					}
				}
			}
		}

		//else
		//assert false : "Invalid type for "+o+", "+o.getClass();
		public virtual void IfFalse(org.jawk.intermediate.IAddress address)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_IFFALSE_, address));
		}

		public virtual void ToNumber()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_TO_NUMBER_));
		}

		public virtual void IfTrue(org.jawk.intermediate.IAddress address)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_IFTRUE_, address));
		}

		public virtual void GotoAddress(org.jawk.intermediate.IAddress address)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_GOTO_, address));
		}

		public virtual org.jawk.intermediate.IAddress CreateAddress(string label)
		{
            int I = 0;
            if(address_label_counts.ContainsKey(label))
            {
                I = address_label_counts[label];
                I = I + 1;
            }
			
			address_label_counts[label] = I;
			org.jawk.intermediate.IAddress address = new org.jawk.intermediate.AwkTuples.AddressImpl
				(label + "_" + I);
			unresolved_addresses.Add(address);
			return address;
		}

		public virtual org.jawk.intermediate.AwkTuples Address(org.jawk.intermediate.IAddress
			 address)
		{
			if (unresolved_addresses.Contains(address))
			{
				unresolved_addresses.Remove(address);
				address.AssignIndex(queue.Count);
				address_indexes[queue.Count] = address;
				return this;
			}
			throw new System.Exception(address.ToString() + " is already resolved, or unresolved from another scope."
				);
		}

		public virtual void Nop()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_NOP_));
		}

		public virtual void Print(int num_exprs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PRINT_, num_exprs));
		}

		public virtual void PrintToFile(int num_exprs, bool append)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PRINT_TO_FILE_, num_exprs, append
				));
		}

		public virtual void PrintToPipe(int num_exprs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PRINT_TO_PIPE_, num_exprs));
		}

		public virtual void Printf(int num_exprs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PRINTF_, num_exprs));
		}

		public virtual void PrintfToFile(int num_exprs, bool append)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PRINTF_TO_FILE_, num_exprs, 
				append));
		}

		public virtual void PrintfToPipe(int num_exprs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PRINTF_TO_PIPE_, num_exprs));
		}

		public virtual void Sprintf(int num_exprs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SPRINTF_, num_exprs));
		}

		public virtual void Length(int num_exprs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_LENGTH_, num_exprs));
		}

		public virtual void Concat()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CONCAT_));
		}

		public virtual void Assign(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ASSIGN_, offset, is_global));
		}

		public virtual void AssignArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ASSIGN_ARRAY_, offset, is_global
				));
		}

		public virtual void AssignAsInput()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ASSIGN_AS_INPUT_));
		}

		public virtual void AssignAsInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ASSIGN_AS_INPUT_FIELD_));
		}

		public virtual void Dereference(int offset, bool is_array, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DEREFERENCE_, offset, is_array
				, is_global));
		}

		public virtual void PlusEq(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PLUS_EQ_, offset, is_global)
				);
		}

		public virtual void MinusEq(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MINUS_EQ_, offset, is_global
				));
		}

		public virtual void MultEq(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MULT_EQ_, offset, is_global)
				);
		}

		public virtual void DivEq(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DIV_EQ_, offset, is_global));
		}

		public virtual void ModEq(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MOD_EQ_, offset, is_global));
		}

		public virtual void PowEq(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_POW_EQ_, offset, is_global));
		}

		public virtual void PlusEqArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PLUS_EQ_ARRAY_, offset, is_global
				));
		}

		public virtual void MinusEqArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MINUS_EQ_ARRAY_, offset, is_global
				));
		}

		public virtual void MultEqArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MULT_EQ_ARRAY_, offset, is_global
				));
		}

		public virtual void DivEqArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DIV_EQ_ARRAY_, offset, is_global
				));
		}

		public virtual void ModEqArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MOD_EQ_ARRAY_, offset, is_global
				));
		}

		public virtual void PowEqArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_POW_EQ_ARRAY_, offset, is_global
				));
		}

		public virtual void PlusEqInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_PLUS_EQ_INPUT_FIELD_));
		}

		public virtual void MinusEqInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MINUS_EQ_INPUT_FIELD_));
		}

		public virtual void MultEqInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MULT_EQ_INPUT_FIELD_));
		}

		public virtual void DivEqInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DIV_EQ_INPUT_FIELD_));
		}

		public virtual void ModEqInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MOD_EQ_INPUT_FIELD_));
		}

		public virtual void PowEqInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_POW_EQ_INPUT_FIELD_));
		}

		public virtual void Srand(int num)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SRAND_, num));
		}

		public virtual void Rand()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_RAND_));
		}

		public virtual void IntFunc()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_INTFUNC_));
		}

		public virtual void Sqrt()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SQRT_));
		}

		public virtual void Log()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_LOG_));
		}

		public virtual void Exp()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_EXP_));
		}

		public virtual void Sin()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SIN_));
		}

		public virtual void Cos()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_COS_));
		}

		public virtual void Atan2()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ATAN2_));
		}

		public virtual void Match()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MATCH_));
		}

		public virtual void Index()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_INDEX_));
		}

		public virtual void SubForDollar0(bool is_gsub)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SUB_FOR_DOLLAR_0_, is_gsub));
		}

		public virtual void SubForDollarReference(bool is_gsub)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SUB_FOR_DOLLAR_REFERENCE_, is_gsub
				));
		}

		public virtual void SubForVariable(int offset, bool is_global, bool is_gsub)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SUB_FOR_VARIABLE_, offset, is_global
				, is_gsub));
		}

		public virtual void SubForArrayReference(int offset, bool is_global, bool is_gsub
			)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SUB_FOR_ARRAY_REFERENCE_, offset
				, is_global, is_gsub));
		}

		public virtual void Split(int numargs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SPLIT_, numargs));
		}

		public virtual void Substr(int numargs)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SUBSTR_, numargs));
		}

		public virtual void Tolower()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_TOLOWER_));
		}

		public virtual void Toupper()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_TOUPPER_));
		}

		public virtual void System()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SYSTEM_));
		}

		public virtual void Exec()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_EXEC_));
		}

		public virtual void Swap()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SWAP_));
		}

		public virtual void Add()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ADD_));
		}

		public virtual void Subtract()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SUBTRACT_));
		}

		public virtual void Multiply()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MULTIPLY_));
		}

		public virtual void Divide()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DIVIDE_));
		}

		public virtual void Mod()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MOD_));
		}

		public virtual void Pow()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_POW_));
		}

		public virtual void Inc(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_INC_, offset, is_global));
		}

		public virtual void Dec(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DEC_, offset, is_global));
		}

		public virtual void IncArrayRef(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_INC_ARRAY_REF_, offset, is_global
				));
		}

		public virtual void DecArrayRef(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DEC_ARRAY_REF_, offset, is_global
				));
		}

		public virtual void IncDollarRef()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_INC_DOLLAR_REF_));
		}

		public virtual void DecDollarRef()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DEC_DOLLAR_REF_));
		}

		public virtual void Dup()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DUP_));
		}

		public virtual void Not()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_NOT_));
		}

		public virtual void Negate()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_NEGATE_));
		}

		public virtual void CmpEq()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CMP_EQ_));
		}

		public virtual void CmpLt()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CMP_LT_));
		}

		public virtual void CmpGt()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CMP_GT_));
		}

		public virtual void Matches()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_MATCHES_));
		}

		public virtual void Sleep(int num_args)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SLEEP_, num_args));
		}

		public virtual void Dump(int num_args)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DUMP_, num_args));
		}

		public virtual void DereferenceArray()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DEREF_ARRAY_));
		}

		public virtual void Keylist()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_KEYLIST_));
		}

		public virtual void IsEmptyList(org.jawk.intermediate.IAddress address)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_IS_EMPTY_KEYLIST_, address));
		}

		public virtual void GetFirstAndRemoveFromList()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_GET_FIRST_AND_REMOVE_FROM_KEYLIST_
				));
		}

		public virtual bool CheckClass(System.Type cls)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CHECK_CLASS_, cls));
			return true;
		}

		public virtual void GetInputField()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_GET_INPUT_FIELD_));
		}

		public virtual void ConsumeInput(org.jawk.intermediate.IAddress address)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CONSUME_INPUT_, address));
		}

		public virtual void GetlineInput()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_GETLINE_INPUT_));
		}

		public virtual void UseAsFileInput()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_USE_AS_FILE_INPUT_));
		}

		public virtual void UseAsCommandInput()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_USE_AS_COMMAND_INPUT_));
		}

		public virtual void NfOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_NF_OFFSET_, offset));
		}

		public virtual void NrOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_NR_OFFSET_, offset));
		}

		public virtual void FnrOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_FNR_OFFSET_, offset));
		}

		public virtual void FsOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_FS_OFFSET_, offset));
		}

		public virtual void RsOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_RS_OFFSET_, offset));
		}

		public virtual void OfsOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_OFS_OFFSET_, offset));
		}

		public virtual void RstartOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_RSTART_OFFSET_, offset));
		}

		public virtual void RlengthOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_RLENGTH_OFFSET_, offset));
		}

		public virtual void FilenameOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_FILENAME_OFFSET_, offset));
		}

		public virtual void SubsepOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SUBSEP_OFFSET_, offset));
		}

		public virtual void ConvfmtOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CONVFMT_OFFSET_, offset));
		}

		public virtual void OfmtOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_OFMT_OFFSET_, offset));
		}

		public virtual void EnvironOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ENVIRON_OFFSET_, offset));
		}

		public virtual void ArgcOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ARGC_OFFSET_, offset));
		}

		public virtual void ArgvOffset(int offset)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_ARGV_OFFSET_, offset));
		}

		public virtual void ApplyRS()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_APPLY_RS_));
		}

		public virtual void Function(string func_name, int num_formal_params)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_FUNCTION_, func_name, num_formal_params
				));
		}

		//public void callFunction(Address addr, String func_name, int num_formal_params, int num_actual_params) { queue.add(new Tuple(_CALL_FUNCTION_, addr, func_name, num_formal_params, num_actual_params)); }
		public virtual void CallFunction(org.jawk.intermediate.IHasFunctionAddress has_func_addr
			, string func_name, int num_formal_params, int num_actual_params)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CALL_FUNCTION_, has_func_addr
				, func_name, num_formal_params, num_actual_params));
		}

		public virtual void SetReturnResult()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SET_RETURN_RESULT_));
		}

		public virtual void ReturnFromFunction()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_RETURN_FROM_FUNCTION_));
		}

		public virtual void SetNumGlobals(int num_globals)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SET_NUM_GLOBALS_, num_globals
				));
		}

		public virtual void Close()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CLOSE_));
		}

		public virtual void ApplySubsep(int count)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_APPLY_SUBSEP_, count));
		}

		public virtual void DeleteArrayElement(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DELETE_ARRAY_ELEMENT_, offset
				, is_global));
		}

		public virtual void DeleteArray(int offset, bool is_global)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_DELETE_ARRAY_, offset, is_global
				));
		}

		public virtual void SetExitAddress(org.jawk.intermediate.IAddress addr)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SET_EXIT_ADDRESS_, addr));
		}

		public virtual void SetWithinEndBlocks(bool b)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_SET_WITHIN_END_BLOCKS_, b));
		}

		public virtual void ExitWithCode()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_EXIT_WITH_CODE_));
		}

		public virtual void Regexp(string regexp_str)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_REGEXP_, regexp_str));
		}

		public virtual void RegexpPair()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_REGEXP_PAIR_));
		}

		public virtual void IsIn()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_IS_IN_));
		}

		public virtual void CastInt()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CAST_INT_));
		}

		public virtual void CastDouble()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CAST_DOUBLE_));
		}

		public virtual void CastString()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_CAST_STRING_));
		}

		public virtual void ScriptThis()
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_THIS_));
		}

		public virtual void Extension(string extension_keyword, int param_count, bool is_initial
			)
		{
			queue.Add(new org.jawk.intermediate.AwkTuples.Tuple(_EXTENSION_, extension_keyword
				, param_count, is_initial));
		}

		public virtual void Dump(System.IO.TextWriter ps)
		{
			ps.WriteLine("(" + version_manager + ")");
			ps.WriteLine();
			for (int i = 0; i < queue.Count; i++)
			{
				org.jawk.intermediate.IAddress address = null;    
                if(address_indexes.ContainsKey(i))
                {
                    address = address_indexes[i]; 
                }
				if (address == null)
				{
					ps.WriteLine(i + " : " + queue[i]);
				}
				else
				{
					ps.WriteLine(i + " : [" + address + "] : " + queue[i]);
				}
			}
		}

		public virtual org.jawk.intermediate.IPosition Top()
		{
			return new org.jawk.intermediate.AwkTuples.PositionImpl(this);
		}

		/// <summary>Executed after all tuples are entered in the queue.</summary>
		/// <remarks>
		/// Executed after all tuples are entered in the queue.
		/// Its main functions are:
		/// <ul>
		/// <li>Assign queue.next to the next element in the queue.
		/// <li>Calls touch(...) per Tuple so that addresses can be normalized/assigned/allocated
		/// properly.
		/// </ul>
		/// </remarks>
		public virtual void PostProcess()
		{
			//assert queue.size() == 0 || queue.get(0).next == null : "postProcess() already executed";
			// allocate nexts
			for (int i = 0; i < queue.Count - 1; i++)
			{
				queue[i].next = queue[i + 1];
			}
			// touch per element
			foreach (org.jawk.intermediate.AwkTuples.Tuple tuple in queue)
			{
				tuple.Touch(queue);
			}
		}

		private System.Collections.Generic.IDictionary<string, int> global_var_offset_map
			 = new System.Collections.Generic.Dictionary<string, int>();

		private System.Collections.Generic.IDictionary<string, bool> global_var_aarray_map
			 = new System.Collections.Generic.Dictionary<string, bool>();

		private System.Collections.Generic.ICollection<string> function_names = null;

		/// <summary>
		/// Accept a {variable_name -&gt; offset} mapping such that global variables can be
		/// assigned while processing name=value and filename command-line arguments.
		/// </summary>
		/// <remarks>
		/// Accept a {variable_name -&gt; offset} mapping such that global variables can be
		/// assigned while processing name=value and filename command-line arguments.
		/// </remarks>
		public virtual void AddGlobalVariableNameToOffsetMapping(string varname, int offset
			, bool is_aarray)
		{
			if (global_var_offset_map.ContainsKey(varname))
			{
				//assert global_var_aarray_map.get(varname) != null;
				return;
			}
			global_var_offset_map[varname] = offset;
			global_var_aarray_map[varname] = is_aarray;
		}

		/// <summary>Accept a set of function names from the parser.</summary>
		/// <remarks>
		/// Accept a set of function names from the parser.  This is
		/// useful for invalidating name=value assignments from the
		/// command line parameters, either via -v arguments or
		/// passed into ARGV.
		/// </remarks>
		/// <param name="function_names">A set of function name strings.</param>
		public virtual void SetFunctionNameSet(System.Collections.Generic.ICollection<string> function_names)
		{
			// setFunctionNameSet is called with a keySet from
			// a HashMap as a parameter, which is NOT
			// Serializable.  Creating a new HashSet around
			// the parameter resolves the issue.
			// Otherwise, attempting to serialize this
			// object results in a NotSerializableEexception
			// being thrown because of function_names field
			// being a keyset from a HashMap.
			this.function_names = new List<string>(function_names);
		}

		public virtual System.Collections.Generic.IDictionary<string, int> GetGlobalVariableOffsetMap
			()
		{
			return global_var_offset_map;
		}

		public virtual System.Collections.Generic.IDictionary<string, bool> GetGlobalVariableAarrayMap
			()
		{
			return global_var_aarray_map;
		}

		public virtual System.Collections.Generic.ICollection<string> GetFunctionNameSet(
			)
		{
			//assert function_names != null;
			return function_names;
		}

		private org.jawk.util.IMyStack<int> lineno_stack = new org.jawk.util.LinkedListStackImpl
			<int>();

		// linenumber stack ...
		/// <summary>Push the current line number onto the line number stack.</summary>
		/// <remarks>
		/// Push the current line number onto the line number stack.
		/// This is called by the parser to keep track of the
		/// current source line number.  Keeping track of line
		/// numbers this way allows the runtime to report
		/// more meaningful errors by providing source line numbers
		/// within error reports.
		/// </remarks>
		/// <param name="lineno">The current source line number.</param>
		public virtual void PushSourceLineNumber(int lineno)
		{
			lineno_stack.Push(lineno);
		}

		public virtual void PopSourceLineNumber(int lineno)
		{
			int tos = lineno_stack.Pop();
		}

		/// <summary>Intermediate file version manager.</summary>
		/// <remarks>
		/// Intermediate file version manager.  Ensures the AwkTuples
		/// class version matches the version supported by the interpreter/compiler.
		/// </remarks>
		[System.Serializable]
		private class VersionManager
		{
			/// <summary>Class version number.</summary>
			/// <remarks>
			/// Class version number.
			/// This number is modified by the developer.
			/// It should be modified only if modifications
			/// to pre-existing tuple arguments are modified,
			/// or if instruction codes are removed.
			/// <p>
			/// <ul>
			/// <li> Version 1 - Initial release.
			/// <li> Version 2 - Changes to support compilation to JVM.
			/// </ul>
			/// </remarks>
			private const byte CLASS_VERSION = 2;

			/// <summary>Instance version number.</summary>
			/// <remarks>
			/// Instance version number.
			/// The only way it could be different from the
			/// class version is only during deserialization.
			/// </remarks>
			private byte INSTANCE_VERSION = CLASS_VERSION;

			//assert(lineno == tos);
			/// <summary>
			/// Upon deserialization, ensures the instance
			/// version matches the class version.
			/// </summary>
			/// <remarks>
			/// Upon deserialization, ensures the instance
			/// version matches the class version.
			/// </remarks>
			/// <exception cref="System.IO.IOException">upon an IO error</exception>
			/// <exception cref="System.TypeLoadException">
			/// if the class
			/// that is deserialized cannot be found
			/// </exception>
			/// <exception cref="java.io.InvalidClassException">
			/// if the
			/// instance version does not match
			/// the class version
			/// </exception>
			private void ReadObject(Stream ois)
			{
                byte[] buf = new byte[1];
                
                if(ois.Read(buf, 0, 1)==1)
			    {
			        INSTANCE_VERSION = buf[0];

			        if (INSTANCE_VERSION != CLASS_VERSION)
			        {
			            throw new InvalidDataException("Invalid intermeidate file format (instance version "
			                                                    + INSTANCE_VERSION + " != class version " + CLASS_VERSION + ")");
			        }
			    } else
                {
                    throw new Exception("Streal seems to be empty");
                }
			}

			/// <exception cref="System.IO.IOException"></exception>
			private void WriteObject(Stream oos)
			{
				oos.Write(new byte[]{ INSTANCE_VERSION }, 0, 1);
			}

			public override string ToString()
			{
				return "intermediate file format version = " + INSTANCE_VERSION;
			}
		}

		private org.jawk.intermediate.AwkTuples.VersionManager version_manager = new org.jawk.intermediate.AwkTuples.VersionManager
			();

		public AwkTuples()
		{
			queue = new _List_1340(this, 100);
		}
	}
}
